<style>
.table-bordered > thead > tr > th, .table-bordered > thead > tr > td {

    white-space: nowrap;
    text-align: center;
    vertical-align: middle!important;
}
.table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
     white-space: nowrap;
	text-align: center;
    vertical-align: middle!important;
	    border: 1px solid #ddd;
}
.fixed-table-body{
	
}
</style>
<?php if(AdminAuth('finance/extract/week/round_analysis_view') &&!empty($WeekInfo[$key]['all'])){?>
<div class=" panel panel-default " style="width: 100%;">
	<div class="panel-heading">
        <h3 class="panel-title">
            提成详情表
        </h3>
    </div>
	<div class="fixed-table-body panel-body">
	<table  class="table table-bordered table-hover" width="100%">
		   <thead>
				<tr>
					 <th rowspan="2"><?php echo __('Id');?></th>
					 <th rowspan="2"><?php echo __('Season.Season_time');?></th>
					 <th rowspan="2"><?php echo __('Address');?></th>
					 <th rowspan="2"><?php echo __('Season.Lecturer_id');?></th>
					 <th rowspan="2"><?php echo __('Season.Subject_id');?></th>
					 <th rowspan="2"><?php echo __('Data.num');?></th>
					 <th colspan="<?php echo 5;?>"><?php echo __('Sales.info');?></th>
					 <th rowspan="2"><?php echo __('Round.num');?></th>
					 <th rowspan="2"><?php echo __('Round.price');?></th>
					 <th rowspan="2"><?php echo __('一轮书总成本');?></th>
					 <th rowspan="2"><?php echo __('扣除成本后金额');?></th>
					 <th rowspan="2"><?php echo __('单科/组合 总价');?></th>
					 <th rowspan="2"><?php echo __('50应发');?></th>
					 <th rowspan="2"><?php echo __('55应发');?></th>
					 <th rowspan="2"><?php echo __('60应发');?></th>
					 <th rowspan="2"><?php echo __('应发版税');?></th>
					 <th rowspan="2"><?php echo __('2986折合');?></th>
					 <th rowspan="2"><?php echo __('4000折合');?></th>
				</tr>
				<tr>
					<th><?php echo __('Pricing.price');?></th>
					<th><?php echo __('Sales.price');?></th>
					<th><?php echo __('Pricing.num');?></th>
					<th><?php echo __('销售总金额');?></th>
					<th><?php echo __('Desc');?></th>
				</tr>
		   </thead>
		   <tbody>
	
				<?php foreach($WeekInfo[$key]['all'] as $kk=>$vv){?>
						<?php
				
						$count = count($vv['round']);
						 $i = 1;
						?>
						<?php foreach($vv['round'] as $k=>$v){ ?>
						<tr>
							<?php if($i == 1){ ?>
								<td rowspan="<?php echo $count?>"><?php echo $kk;?></td>
								<td rowspan="<?php echo $count?>"><?php echo $vv['season_time'];?></td>
								<td rowspan="<?php echo $count?>"><?php echo $vv['address'];?></td>
								<td rowspan="<?php echo $count?>"><?php echo $vv['lecturer_name'];?></td>
								<td rowspan="<?php echo $count?>"><?php echo $vv['subject_name'];?></td>
								<td rowspan="<?php echo $count?>"><?php echo $vv['round_num'];?></td>
							<?php }?>
								<?php 
								if(isset($v['pricing_type'])){
								if($v['pricing_type'] == 2){ ?>
								 <td><a href="javascript:;" class="pricing_data" attrv="<?php echo $k?>"><?php echo $v['pricing_price'] ?? '';?></a></td>
								 <textarea class="pricing_data_<?php echo $k;?> hide"><?php echo $v['data_info'];?></textarea>
								<?php }else{ ?>
							   	 <td><?php echo $v['pricing_price'] ?? '';?></td>
								<?php }
							} ?>
							    <td><?php echo $v['sales_price'] ?? '';?></td>
							    <td><?php echo $v['pricing_num'] ?? '';?></td>
							    <td><?php echo $v['price_total'] ?? '';?></td>
							    <td><?php echo $v['desc'] ?? '';?></td>
							    <td><?php echo $v['round_num'] ?? '';?></td>
							    <td><?php echo $v['round_price'] ?? '';?></td>
							    <td><?php echo $v['round_priceTotal'] ?? '';?></td>
							    <td><?php echo $v['sales_priceTotal'] ?? '';?></td>
							    <td><?php echo $v['pricing_total'] ?? '';?></td>
								<td><?php echo $v['Company50_price'] ?? 0; ?></td>
								<td><?php echo $v['Company55_price'] ?? 0; ?></td>
								<td><?php echo $v['Company60_price'] ?? 0; ?></td>
								<td><?php echo $v['should_price'] ?? 0; ?></td>
								<td><?php echo $v['into_29'] ?? 0; ?></td>
								<td><?php echo $v['into_40'] ?? 0; ?></td>
							<?php 
								$i++;
								unset($k,$v);
							?>
						</tr>
						<?php 
							}
							unset($kk,$vv,$i);
						?>
					
				 <?php }?>
		
			 <tr >
					<td colspan="5">合计</td>
					<td><?php echo $WeekInfo[$key]['total']['round_num']?></td>
					<td></td>
					<td></td>
					<td><?php echo $WeekInfo[$key]['total']['pricing_num']?></td>
					<td><?php echo $WeekInfo[$key]['total']['price_total']?></td>
					<td></td>
					<td><?php echo $WeekInfo[$key]['total']['round_num']?></td>
					<td></td>
					<td><?php echo $WeekInfo[$key]['total']['round_priceTotal']?></td>
					<td><?php echo $WeekInfo[$key]['total']['sales_priceTotal']?></td>
					<td><?php echo $WeekInfo[$key]['total']['pricing_total']?></td>
					<td><?php echo $WeekInfo[$key]['total']['Company50_price']?></td>
					<td><?php echo $WeekInfo[$key]['total']['Company55_price']?></td>
					<td><?php echo $WeekInfo[$key]['total']['Company60_price']?></td>
					<td><?php echo $WeekInfo[$key]['total']['should_price']?></td>
					<td><?php echo $WeekInfo[$key]['total']['into_29']?></td>
					<td><?php echo $WeekInfo[$key]['total']['into_40']?></td>
					
			 </tr>
		   </tbody>
		
	</table>
	</div>
</div>
<?php }?>
<?php if(AdminAuth('finance/extract/week/round_analysis_royalty') && !empty($WeekInfo['UserRoundExtract']['User'])){?>
<div class="panel panel-default " style="width: 50%;">
	<div class="panel-heading">
        <h3 class="panel-title">
            提成表
            <span class="pull-right">
			2986折合：<?php echo '一轮书:',$WeekInfo[$key]['total']['into_29'],' 提分宝典:',$WeekInfo['Analysis']['total']['into_cost_29'];?>
			合计：<?php echo $WeekInfo[$key]['total']['into_29']+$WeekInfo['Analysis']['total']['into_cost_29'];?>
			</span>
        </h3>
    </div>
	<div class="fixed-table-body panel-body">
	<table  class="table table-bordered table-hover" width="100%">
		   <thead>
		        <tr>
					<th>岗位</th>
					<th>姓名</th>
					<th>提成类型</th>
					<th>外联积分</th>
					<th>图书积分</th>
					<th>第一部分</th>
					<th>第二部分</th>
					<th>合计</th>
				
				</tr>
				
		   </thead>
		   <tbody>
		   <?php foreach($WeekInfo['UserRoundExtract']['User'] as $kk=>$vv){?>
				  <?php $i = 1;?>
				 <?php foreach($vv['extract_round'] as $k=>$v){?>
				   <tr>
					  <?php if($i == 1){ ?>
						<td rowspan="<?php echo $vv['count_round'];?>"><?php echo $vv['position_text'];?></td>
						<td rowspan="<?php echo $vv['count_round'];?>"><?php echo $vv['username_text'];?></td>
					  <?php }?>
						 <td><?php echo $v['title']??'';?></td>
						<?php if($i == 1){ ?>
							<td rowspan="<?php echo $vv['count_round'];?>"><?php echo $vv['integral_otreach'] > 0 ? $vv['integral_otreach'].' 占比:'.$vv['integral_proportion'].'%':'-';?></td>
							<td rowspan="<?php echo $vv['count_round'];?>"><?php echo $vv['integral_books'] > 0 ?$vv['integral_books'].' 占比:'.$vv['books_proportion'].'%':'-';?></td>
						<?php }?>
						 <td><?php echo $v['price']??0;?></td>
					  <?php if($i == 1){ ?>
						<td rowspan="<?php echo $vv['count_round'];?>"><?php echo $vv['week_total_round_two'];?></td>
						<td rowspan="<?php echo $vv['count_round'];?>"><?php echo $vv['week_total_round'];?></td>
					  <?php }?>
					  <?php $i++;?>
				   </tr>
				<?php }?>
			<?php }?>
			  <tr>
				<td colspan="3">合计</td>
				<td><?php echo $WeekInfo['UserRoundExtract']['Total']['week_total_integral_otreach'] ?? 0;?></td>
				<td><?php echo $WeekInfo['UserRoundExtract']['Total']['week_total_integral_books'] ?? 0;?></td>
				<td><?php echo $WeekInfo['UserRoundExtract']['Total']['week_total_round_one'] ?? 0;?></td>
				<td><?php echo $WeekInfo['UserRoundExtract']['Total']['week_total_round_two'] ?? 0;?></td>
				<td><?php echo $WeekInfo['UserRoundExtract']['Total']['week_total_round'] ?? 0;?></td>
			  </tr>
		   </tbody>
		
	</table>
	</div>
</div>

<?php }?>
